﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AgentMaster.master" AutoEventWireup="true" CodeBehind="Ticket.aspx.cs" Inherits="doris.Agent.Ticket" %>
<asp:Content ID="Content1" ContentPlaceHolderID="sidebar" runat="server">
    <p><asp:DetailsView 
        ID="assignedTo" CssClass="assignedTo dorisDetail" runat="server" AutoGenerateRows="False" 
        DataKeyNames="TickedAssignedID" DataSourceID="SqlDataSource3"><Fields><asp:BoundField 
                DataField="TickedAssignedID" HeaderText="TickedAssignedID" 
                InsertVisible="False" ReadOnly="True" SortExpression="TickedAssignedID" 
                Visible="False" /><asp:BoundField DataField="Username" 
                HeaderText="Brukernavn" SortExpression="Username" /></Fields><HeaderTemplate>Ansvarlige</HeaderTemplate></asp:DetailsView>            
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:localConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:localConnectionString.ProviderName %>" 
            SelectCommand="getResponsibleForTicket" SelectCommandType="StoredProcedure"><SelectParameters><asp:QueryStringParameter 
                    DefaultValue="0" Name="in_ticketid" QueryStringField="id" Type="Int32" /></SelectParameters></asp:SqlDataSource>
</p></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Panel ID="Panel1" runat="server" Height="192px">
    <asp:Panel ID="Message" CssClass="panelMessage" runat="server" Height="16px"> </asp:Panel>
    <div style="width: 250px; overflow: auto">
        <asp:DetailsView ID="dTicket" runat="server" Height="12px" Width="244px" 
            AutoGenerateRows="False" DataKeyNames="TicketID" DataSourceID="SqlDataSource1"
            CssClass="dorisDetail" Font-Size="11px" CellPadding="4" 
            ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
            <EditRowStyle BackColor="#999999" />
            <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
            <Fields>
                <asp:BoundField DataField="TicketID" HeaderText="TicketID" 
                    InsertVisible="False" ReadOnly="True" SortExpression="TicketID" 
                    Visible="False" />
                <asp:BoundField DataField="TicketStatusID" HeaderText="TicketStatusID" 
                    SortExpression="TicketStatusID" Visible="False" />
                <asp:BoundField DataField="Status" HeaderText="Status" 
                    SortExpression="Status" />
                <asp:BoundField DataField="TicketPriorityID" HeaderText="TicketPriorityID" 
                    SortExpression="TicketPriorityID" Visible="False" />
                <asp:BoundField DataField="Priority" HeaderText="Prioritet" 
                    SortExpression="Priority" />
                <asp:BoundField DataField="Title" HeaderText="Tittel" SortExpression="Title" />
                <asp:BoundField DataField="CreatedDate" HeaderText="Opprettet" 
                    SortExpression="CreatedDate" />
                <asp:BoundField DataField="UpdatedDate" HeaderText="Oppdatert" 
                    SortExpression="UpdatedDate" />
                <asp:BoundField DataField="PendingDate" HeaderText="Forventet" 
                    SortExpression="PendingDate" />
                <asp:CheckBoxField DataField="Locked" HeaderText="L&aring;st" 
                    SortExpression="Locked" />
                <asp:BoundField DataField="UserID" HeaderText="BrukerID" SortExpression="UserID" 
                    Visible="False" />
                <asp:BoundField DataField="Username" HeaderText="Brukernavn" 
                    SortExpression="Username" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            </Fields>
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="16px" 
                ForeColor="White" />
            <HeaderTemplate>
                Ticket
            </HeaderTemplate>
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        </asp:DetailsView>
        </div>
    </asp:Panel>
    <p>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:localConnectionString %>" 
            DeleteCommand="deleteTicket" DeleteCommandType="StoredProcedure" 
            InsertCommand="addTicket" InsertCommandType="StoredProcedure" 
            ProviderName="<%$ ConnectionStrings:localConnectionString.ProviderName %>" 
            SelectCommand="getTicket" SelectCommandType="StoredProcedure" 
            UpdateCommand="updateTicket" UpdateCommandType="StoredProcedure">
            <DeleteParameters>
                <asp:Parameter Name="in_ticketid" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="in_title" Type="String" />
                <asp:Parameter Name="in_userid" Type="String" />
                <asp:Parameter Name="in_ticketpriorityid" Type="Int32" />
                <asp:Parameter Name="in_message" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0" Name="in_ticketid" 
                    QueryStringField="id" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="in_ticketid" Type="Int32" />
                <asp:Parameter Name="in_ticketstatusid" Type="Int32" />
                <asp:Parameter Name="in_ticketpriorityid" Type="Int32" />
                <asp:Parameter Name="in_title" Type="String" />
                <asp:Parameter Name="in_pendingdate" Type="DateTime" />
                <asp:Parameter Name="in_locked" Type="Object" />
                <asp:Parameter Name="in_userid" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </p>
    <p>
        &nbsp;</p>
    <p>
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        &nbsp;</p>
    <p>
        <asp:GridView ID="TicketData" runat="server" DataSourceID="SqlDataSource2" 
            AutoGenerateColumns="False" DataKeyNames="TicketDataID" 
            CssClass="dorisGrid" AlternatingRowStyle-CssClass="alt" Font-Size="12pt">
            <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
            <Columns>
                <asp:BoundField DataField="TicketDataID" HeaderText="TicketDataID" 
                    InsertVisible="False" ReadOnly="True" SortExpression="TicketDataID" 
                    Visible="False" />
                <asp:BoundField DataField="CreatedDate" HeaderText="Opprettet" 
                    SortExpression="CreatedDate" />
                <asp:BoundField DataField="UpdatedDate" HeaderText="Oppdatert" 
                    SortExpression="UpdatedDate" Visible="False" />
                <asp:TemplateField HeaderText="Tittel" SortExpression="Title">
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink1" NavigateUrl='<%# "~/Agent/Ticket.aspx?id=" + Request.QueryString["id"] + "&d=" + Eval("TicketDataID") %>' runat="server"><asp:Label ID="Title" runat="server" Text='<%# Bind("Title") %>' /></asp:HyperLink></ItemTemplate><EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox></EditItemTemplate></asp:TemplateField><asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
                <asp:BoundField DataField="WorkMinutes" HeaderText="WorkMinutes" 
                    SortExpression="WorkMinutes" Visible="False" />
                <asp:BoundField DataField="AgentID" HeaderText="AgentID" 
                    SortExpression="AgentID" Visible="False" />
                <asp:BoundField DataField="TickedAssignedID" HeaderText="TickedAssignedID" 
                    SortExpression="TickedAssignedID" Visible="False" />
                <asp:BoundField DataField="ParentTicketDataID" HeaderText="ParentTicketDataID" 
                    SortExpression="ParentTicketDataID" Visible="False" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:localConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:localConnectionString.ProviderName %>" 
            SelectCommand="getTicketData" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0" Name="in_ticketid" 
                    QueryStringField="id" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>    
    <asp:Panel ID="Panel2" CssClass="goLeft" runat="server"><asp:HyperLink ID="lnkReply" 
            runat="server" CssClass="links" Visible="false">Svar</asp:HyperLink><asp:HyperLink runat="server" 
            ID="lLock" NavigateUrl='<%# "/Agent/Ticket.aspx" %>' CssClass="links" Visible="false">L&aring;s</asp:HyperLink><asp:HyperLink runat="server" ID="takeCase" CssClass="links" NavigateUrl='<%# "/Agent/Ticket.aspx" %>'>Ta sak</asp:HyperLink></asp:Panel><p><asp:HyperLink 
            ID="HyperLink2" NavigateUrl="/Agent/Default.aspx" CssClass="links" runat="server">Tilbake</asp:HyperLink></p></asp:Content>